home *** CD-ROM | disk | FTP | other *** search
- !!Script
- // Copyright ⌐ 1997-1998 - Modelworks Software
-
- /**
- @Tool: insert Switch~inserts the Switch node. The Switch grouping node
- traverses zero or one of the nodes specified in the choice field.
- @EndTool:
- @Summary: insert Switch~inserts the Switch node
- */
-
- var Node =
- "Switch {" +
- "\n\twhichChoice -1 # exposedField SFInt32" +
- "\n\tchoice # exposedField MFNode" +
- "\n\t[" +
- "\n\t\t@Caret" +
- "\n\t]" +
- "\n}" +
- "\n";
-
- function DoCommand()
- {
- var textUtilities = getScriptObject("Library\\textUtilities.script");
- if (textUtilities)
- {
- var editor = getActiveEditor();
- if (editor)
- {
- var lineIndex = textUtilities.InsertString(editor, Node);
-
- // Now replace @Caret with the real caret
- var range = editor.findFirst("@Caret", lineIndex, 0);
- editor.replace("", range);
- editor.setActive("Insert Switch Node");
- }
- }
- }
-
- !!/Script
-
-